<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<!-- Initiation -->
<%
response.setContentType("text/html; charset=UTF-8");
canss.web.controls.WebDBControl webdbcontrol = null;
webdbcontrol = (webdbcontrol==null)?new canss.web.controls.WebDBControlBean():webdbcontrol;
int i=0;
%>
<%
String _cid = request.getParameter("_cid");
String _src = null;
String _image = null;
if(canss.supports.basic.isEmpty(_cid))
{
	_src = request.getParameter("_src");
	_image = request.getParameter("_image");
	if(_src!=null && ((_src.lastIndexOf(".wmv")>=0) || (_src.lastIndexOf("mms://")>=0) ))
		//out.write("<jsp:forward page=\"/testplayer/content_testview_wmv.jsp\"><jsp:param name=\"_src\" value="+_src+"/></jsp:forward>");
		out.write("<meta http-equiv=\"refresh\" content=\"0; URL=content_testview_wmp.jsp?&_src="+_src+"&_image="+_image+"\"");
}else
{
	/*get mms location  ex)mms:mediafarm.canss.net:8080/_cid.asf*/
	canss.supports.Makequery_select query = new canss.supports.Makequery_select()
	.Select("location")
	.PushFrom("tblLocation")
	.PushWhere(String.format("tblContent_tblCID_cid='%s'", _cid))
	.Limit("0,100");
	java.util.Iterator<String[]> iter = null;
	java.util.Hashtable<String, Integer> hash = null;
	try
	{
		java.util.LinkedList<String[]> res = webdbcontrol.Select(query);
		iter = res.iterator();
		if(iter.hasNext())
		{
			String[] curhashtmp = iter.next();
			hash = new java.util.Hashtable<String, Integer>(curhashtmp.length);
			for(i=0; i<curhashtmp.length; i++)
				hash.put(curhashtmp[i], i);
		}
	}catch(Exception e)
	{
		e.printStackTrace();
	}
	
	i=1;
	if(iter!=null && iter.hasNext())
	{
		String[] cur = iter.next();
		_src = cur[hash.get("location")];
	}else
		_src = "";
	
	_image = "http://mediator.canss.net/MediaFarm/Thumbnail/"+_cid+".jpg";
	if(_src!=null && ((_src.lastIndexOf(".wmv")>=0) || (_src.lastIndexOf("mms://")>=0) ))
		out.write("<meta http-equiv=\"refresh\" content=\"0; URL=content_testview_wmp.jsp?&_src="+_src+"&_image="+_image+"\"");
}
%>

</head>
<body>



<center>
	<!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
	<script type="text/javascript" src="swfobject.js"></script>
	<script type="text/javascript">
		//swfobject.registerObject("player","9.0.98","expressInstall.swf");
	</script>

	<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="328" height="200">
		<param name="movie" value="player-viral.swf" />
		<param name="allowfullscreen" value="true" />
		<param name="allowscriptaccess" value="always" />
		<param name="flashvars" value="file=<%=_src %>&image=<%=_image %>" />
		<object type="application/x-shockwave-flash" data="player-viral.swf" width="328" height="200">
			<param name="movie" value="player-viral.swf" />
			<param name="allowfullscreen" value="true" />
			<param name="allowscriptaccess" value="always" />
			<param name="flashvars" value="file=<%=_src %>&image=<%=_image %>" />
			<p><a href="http://get.adobe.com/flashplayer">Get Flash</a> to see this player.</p>
		</object>
	</object>
	<!-- END OF THE PLAYER EMBEDDING -->
	
	<p><font size="-2">Copyrights. </font><font size="-3">The player is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Creative Commons License</a>. It allows you to use, modify and redistribute the script, but only for <b>noncommercial</b> purposes. For corporate use, <a href="http://www.longtailvideo.com/players/order" title="Order commercial licenses">please apply for a commercial license</a>.</font></p>
</center>

</body>
</html>